package com.starlinkdt.common.storage;

import lombok.Getter;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 对象存储支持厂商
 *
 * @author system
 */
@Getter
public enum StorageEnum {

    /**
     * 返回状态码
     */
    AliYunOss("AliYunOss", "阿里云oss对象存储"),
    HuaweiCloudObs("HuaweiCloudObs", "华为云obs对象存储"),
    CtYunZos("CtYunZos", "天翼云zos对象存储"),
    NsccTjOss("NsccTjOss", "天河云oss对象存储"),
    Minio("Minio", "MINIO对象存储");
    /**
     * 状态码
     */
    private final String code;

    /**
     * 描述
     */
    private final String desc;

    StorageEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 查询map
     */
    private static final Map<String, StorageEnum> MAP = new LinkedHashMap<>();

    static {
        for (StorageEnum storageEnum : StorageEnum.values()) {
            MAP.put(storageEnum.getCode(), storageEnum);
        }
    }

    public static StorageEnum getEnumByCode(String code) {
        return MAP.get(code);
    }

}
